package com.ssm.ssmcontroller;


import com.ssm.po.User;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;


/**
 * Created by Mars-Hasee on 2017/8/5.
 */
public class UserController implements Controller {

    @Override
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        List<User> userList = new ArrayList<>();
        ModelAndView modelAndView = new ModelAndView();
        //相当于reuest 中的setAttrabute方法
        modelAndView.addObject("userList",userList);
        //指定视图
        modelAndView.setViewName("WEB-INF/jsp/index.jsp");
        return modelAndView;
    }

}
